﻿@{
    ViewBag.Title = "Wiki Administration";
    string BUId = ViewBag.BusinessUnitId.ToString();
}

<h1>Wiki Administration</h1>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
@Html.Hidden("hdnBusinessUnitId",BUId)
<div id="dynamic">
<table id="tblWiki" cellspacing="0" cellpadding="10" width="100%" >
<thead>
    <tr>
        <th></th>
        <th>
            Name
        </th>
        <th>
            Modified Date Time
        </th>
        <th>
            Modified By
        </th>
        <th>
            Created By
        </th>
    </tr>
</thead>
<tbody>
	<tr>
		<td colspan="5" class="dataTables_empty">Loading data from server</td>
	</tr>
</tbody>
</table>
</div>
<div class="spacer"></div>
<script type="text/javascript" language="javascript">
    $(function () {
        $('#tblWiki').dataTable({
            "aoColumnDefs": [
            { "bSortable": false, "aTargets": [0] },
			{ "sClass": "nowrap", "aTargets": [0] },
            { "sWidth": "150px", "aTargets": [0] },

            { "bSortable": false, "aTargets": [1] },
            { "sWidth": "96%", "aTargets": [1] },
			{ "sName": "name", "aTargets": [1] },

            { "bSortable": false, "aTargets": [2] },
			{ "sClass": "nowrap", "aTargets": [2] },
            { "sWidth": "1%", "aTargets": [2] },
			{ "sName": "modifieddt", "aTargets": [2] },

            { "bSortable": false, "aTargets": [3] },
			{ "sClass": "nowrap", "aTargets": [3] },
            { "sWidth": "1%", "aTargets": [3] },
			{ "sName": "modifiedbyname", "aTargets": [3] },

            { "bSortable": false, "aTargets": [4] },
			{ "sClass": "nowrap", "aTargets": [4] },
            { "sWidth": "1%", "aTargets": [4] },
			{ "sName": "createdbyname", "aTargets": [4] }
		],
            "sPaginationType": "full_numbers",
            "iDisplayLength": 15,
            "aLengthMenu": [[15, 25, 50], [15, 25, 50]],
            "bStateSave": true,
            "bJQueryUI": true,
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "/Wiki/Admin/WikiList",
            "fnServerData": function (sSource, aoData, fnCallback) {
                aoData.push({ "name": "BusinessUnitId", "value": $("#hdnBusinessUnitId").val() });
                $.ajax({
                    "dataType": 'json',
                    "type": "POST",
                    "url": sSource,
                    "data": aoData,
                    "success": fnCallback
                });
            }
        });
    });
</script>
